package com.hnichr.crm.common.cost.entity;

import com.hnichr.crm.common.customer.entity.CrmCustomer;
import com.hnichr.crm.common.product.entity.CrmProduct;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * 费用对象 crm_cost
 *
 * @author Wp
 * @date 2022-12-21
 */
@Data
@Entity
@Table(name = "crm_cost")
@Schema(description = "费用表")
@EqualsAndHashCode(callSuper = false)
public class CrmCost extends BaseEntity {

    /**
     * id
     */
    @Id
    @Generator
    @Schema(description = "id")
    @Column(name = "id", length = 64)
    private String id;
    /**
     * 费用编号
     */
    @Schema(description = "费用编号")
    @Column(name = "cost_no", length = 64)
    private String costNo;
    /**
     * 费用名称
     */
    @Schema(description = "费用名称")
    @Column(name = "cost_name", length = 255)
    private String costName;
    /**
     * 项目ID
     */
    @Schema(description = "项目ID")
    @Column(name = "product_id")
    @Dict(dicEntity = CrmProduct.class, dicCode = "id", dicText = "name")
    private String productId;
    /**
     * 客户ID
     */
    @Schema(description = "客户ID")
    @Column(name = "customer_id", length = 64)
    @Dict(dicEntity = CrmCustomer.class, dicCode = "id", dicText = "customerName")
    private String customerId;
    /**
     * 费用类型
     */
    @Schema(description = "费用类型")
    @Column(name = "cost_type", length = 64)
    @Dict(dicCode = "cost_type")
    private String costType;
    /**
     * 费用情况描述
     */
    @Schema(description = "费用情况描述")
    @Column(name = "description", length = 255)
    private String description;
    /**
     * 金额
     */
    @Schema(description = "金额")
    @Column(name = "amount")
    private BigDecimal amount;
    /**
     * 状态
     */
    @Schema(description = "状态")
    @Column(name = "status")
    @Dict(dicCode = "cost_status")
    private String status;
    /**
     * 归属人ID
     */
    @Schema(description = "负责人ID")
    @Column(name = "owner_user_id", length = 64)
    @Dict(dicEntity = User.class, dicCode = "username", dicText = "nickname")
    private String ownerUserId;
    /**
     * 所属部门ID
     */
    @Schema(description = "所属部门ID")
    @Column(name = "owner_dept_id", length = 64)
    @Dict(dicEntity = Dept.class, dicCode = "deptCode", dicText = "deptName")
    private String ownerDeptId;
    /**
     * 批次
     */
    @Schema(description = "批次")
    @Column(name = "batch_id", length = 64)
    private String batchId;

    /**
     * 客户名称
     */
    @Schema(description = "客户名称")
    @Column(name = "customer_name", length = 255)
    private String customerName;
    /**
     * 项目名称
     */
    @Schema(description = "项目名称")
    @Column(name = "product_name", length = 255)
    private String productName;
}
